package requests

import (
	"github.com/goravel/framework/contracts/http"
	"github.com/goravel/framework/contracts/validation"
)

type UserRoleRequest struct {
	UserID uint   `form:"user_id" json:"user_id"`
	Roles  []uint `form:"roles" json:"roles"`
}

func (r *UserRoleRequest) Authorize(ctx http.Context) error {
	return nil
}

func (r *UserRoleRequest) Filters(ctx http.Context) map[string]string {
	return map[string]string{}
}

func (r *UserRoleRequest) Rules(ctx http.Context) map[string]string {
	return map[string]string{
		"user_id": "required",
		"roles":   "required",
	}
}

func (r *UserRoleRequest) Messages(ctx http.Context) map[string]string {
	return map[string]string{
		"user_id.required": "用户ID不能为空",
		"roles.required":   "角色不能为空",
	}
}

func (r *UserRoleRequest) Attributes(ctx http.Context) map[string]string {
	return map[string]string{}
}

func (r *UserRoleRequest) PrepareForValidation(ctx http.Context, data validation.Data) error {
	return nil
}
